
<script src="isa_util.js" ></script>

<script src="js_calendar.js" ></script>

<?php
function onegate_pagebreak_selectbox2($p_total_record,$p_current_page,$p_number_record_per_page,$v_fuseaction){
	$v_html_string = "";
	//echo "$p_total_record%$p_number_record_per_page";
	if($p_total_record%$p_number_record_per_page==0){
		$v_number_page = (int)($p_total_record/$p_number_record_per_page);
	}else{
		$v_number_page = (int)($p_total_record/$p_number_record_per_page)+1;
		//echo "v_number_page=".$v_number_page;
	}
	
	$v_html_string = $v_html_string . "T&#7893;ng s&#7889;&nbsp;" . $v_number_page . "&nbsp;trang.&nbsp;&nbsp;Xem &nbsp;" . "<select class='normal_selectbox' name='sel_page' style='width:auto' title='Ch&#7885;n trang mu&#7889;n xem' style='width:40'" . "onChange='page_onchange(this,&quot;" . $v_fuseaction ."&quot;)'" . "onKeyDown='change_focus(document.forms(0),this)' >";
	for ($i=1; $i<=$v_number_page;$i++){				
		if ($p_current_page == $i){
			$v_select = " selected ";
		}else{
			$v_select = " ";
		}
		$v_html_string = $v_html_string . "<option id='' value='$i' name='$i' $v_select> " . "Trang &nbsp;" . $i  . "</option>";
	}
	$v_html_string = $v_html_string . "</select>";
	return $v_html_string;
}

function onegate_change_record_number_page2($v_value,$v_fuseaction){
	$v_html_string = "";
	$v_sql = "ONEGATE_ListGetAllbyCode " . "SO_HS_TREN_TRANG";
	$v_html_string = $v_html_string . "Hi&#7875;n th&#7883; ";
	$v_html_string = $v_html_string . "<select class='normal_selectbox' name='cbo_nuber_record_page' style='width:60' onChange='page_record_number_onchange(this,&quot;" . $v_fuseaction ."&quot;)'" . "onKeyDown='change_focus(document.forms(0),this)'>";
	$v_html_string = $v_html_string . _generate_select_option(Query_Data($v_sql),0,0,1,$v_value);
	$v_html_string = $v_html_string . "</select>";	
	$v_html_string = $v_html_string . "&nbsp;h&#7891; s&#417;/1 trang";
	return $v_html_string;
}

$page = "";
/*
if ($record_count >0){
	$page = onegate_pagebreak_selectbox_vunh($total_record,$v_page,$v_limit_row,$fuseaction,"form_id_".$user_id) ."&nbsp;". onegate_change_record_number_page_vunh($v_limit_row,$fuseaction,"form_id_".$user_id)
	;	
	echo htmlspecialchars($page);		
}
*/
if ($_REQUEST['modal_dialog_mode'] == 1) {
	$template->set_filenames(array("body"=>"template/view_one_user.tpl"));
} else {
	$template->set_filenames(array("body"=>"template/view_one_user_content.tpl"));
}
$template->assign_block_vars("login_info_user", array(
		"div_id"=>"div_id_".$user_id,
		"form_id"=>"form_id_".$user_id,
		"fuseaction"=>$fuseaction,
		"hdn_page"=>$total_record,		// nieuvv----100608--------lay tong so record
		"hdn_record_number_page"=>$v_page,
		"parent_id"=>$id_unit,
		"id"=>$user_id,
		"user_name"=>$user_name,
		"page"=>$page,
		"content_id"=>"content_id_".$user_id
	));
for ($i=0; $i<$record_count; $i++) {
	if ($v_current_style_name == "odd_row"){
		$v_current_style_name = "round_row";
	}else{
		$v_current_style_name = "odd_row";
	}
	$template->assign_block_vars("login_info_user.login_info_row", array(
		"STT"=>$i +1 + ($v_limit_row * ($v_page - 1)),
		//--------------nieuvv - 0906089 - lay ngay dang nhap
		"Date"=>$arr_all_record[$i]["C_DAY"]."-".$arr_all_record[$i]["C_MONTH"]."-".$arr_all_record[$i]["C_YEAR"],	
		//------------ the end nieuvv-------------------
	    "User"=>_get_item_attr_by_id($_SESSION['arr_all_staff'],$arr_all_record[$i]["FK_USER"],'name'),
		"IP"=>$arr_all_record[$i]["C_IP"],
		"Time"=>$arr_all_record[$i]["C_HOUR"].":".$arr_all_record[$i]["C_MINUTE"].":".$arr_all_record[$i]["C_SECOND"],
		"class_row"=>$v_current_style_name
	));
}		
if ($record_count < $v_limit_row) {
	for ($i=$record_count; $i<$v_limit_row; $i++) {
		if ($v_current_style_name == "odd_row"){
		$v_current_style_name = "round_row";
	}else{
		$v_current_style_name = "odd_row";
	}
	$template->assign_block_vars("login_info_user.login_info_row", array(
		"STT"=>$i +1 + ($v_limit_row * ($v_page - 1)),
		"Date"=>"&nbsp;",
		"User"=>"&nbsp;",
		"IP"=>"&nbsp;",
		"Time"=>"&nbsp;",
		"class_row"=>$v_current_style_name
	));
	}
}		

if ($use_page_or_row_limit) {
	$template->pparse("body");		
}
else {
	$template->pparse("body");
}
?>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
	<col width="5%"><col width="95%">
	<tr>
		<td align="right" class="normal_link">
		
		<? 
		//echo "v_limit_row=".$v_limit_row;
			if ($record_count >0){
			// begin---nieuvv---100608-----sua lay so trang xem theo ngay dang nhap-------
				echo onegate_pagebreak_selectbox2($total_record,$v_page,$v_limit_row,$fuseaction) ."&nbsp;". onegate_change_record_number_page2($v_limit_row,$fuseaction);
			//-------------the end nieuvv----------				
			}?>
		</td>
	</tr>
</table>
<script>
function page_onchange(sel_obj,p_fuseaction){
	document.forms(0).hdn_page.value = sel_obj.value;	
	document.forms(0).fuseaction.value = p_fuseaction;
	document.forms(0).submit();
}
function page_record_number_onchange(sel_obj,p_fuseaction){
	document.forms(0).hdn_page.value = 1;
	document.forms(0).hdn_record_number_page.value = sel_obj.value;
	document.forms(0).fuseaction.value = p_fuseaction;
	document.forms(0).submit();
}
</script>